import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(),
  ],
  // assetsInclude: ['**/*.svg'],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
  server: {
    open: true,
    port: 8000,
    // proxy: {
    //   '/api': {
    //     target: 'http://10.1.6.130',
    //     changeOrigin: true,
    //     rewrite: (path) => path.replace(/^\/api/, '/api')
    //   },
    //   '/icons': {
    //     target: 'http://10.1.6.130',
    //      //  target: 'http://localhost:3000',
    //       changeOrigin: true,
    //       rewrite: (path) => path.replace(/^\/icons/, '/icons') // 不可以省略rewrite
    //   },
    //      '/stutasks': {
    //     target: 'http://10.1.6.130',
    //      //  target: 'http://localhost:3000',
    //       changeOrigin: true,
    //       rewrite: (path) => path.replace(/^\/stutasks/, '/stutasks') // 不可以省略rewrite
    //   }
    // }
  }
})
